package com.bank.service.impl;

import com.bank.entity.Deposit;
import com.bank.mapper.DepositMapper;
import com.bank.service.DepositService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 存款类型服务实现类
 */
@Service
public class DepositServiceImpl implements DepositService {

    @Autowired
    private DepositMapper depositMapper;

    @Override
    public List<Deposit> findAll() {
        return depositMapper.findAll();
    }

    @Override
    public Deposit findById(Integer savingID) {
        return depositMapper.findById(savingID);
    }

    @Override
    @Transactional
    public boolean add(Deposit deposit) {
        return depositMapper.insert(deposit) > 0;
    }

    @Override
    @Transactional
    public boolean update(Deposit deposit) {
        return depositMapper.update(deposit) > 0;
    }

    @Override
    @Transactional
    public boolean delete(Integer savingID) {
        return depositMapper.deleteById(savingID) > 0;
    }
} 